package com.zhijian.medical.dao.local;

import com.zhijian.medical.entity.po.AssessmentPaperPerson;
import com.zhijian.medical.entity.vo.request.AssessmentPaperPersonSearchVo;
import com.zhijian.medical.entity.vo.response.AssessmentPaperPersonVo;
import org.apache.ibatis.annotations.Param;

import java.math.BigDecimal;
import java.util.List;

public interface AssessmentPaperPersonMapper {
    int deleteByPrimaryKey(Long id);

    /**
     * 根据考核id进行删除
     *
     * @param assessmentId
     * @return
     */
    int deleteByAssessmentId(Long assessmentId);

    int insert(AssessmentPaperPerson record);

    int insertSelective(AssessmentPaperPerson record);

    AssessmentPaperPerson selectByPrimaryKey(Long id);

    int updateByPrimaryKeySelective(AssessmentPaperPerson record);

    /**
     * 动态修改
     *
     * @param record
     * @return
     */
    boolean updateByUserIdAndAssessmentId(AssessmentPaperPerson record);

    int updateByPrimaryKey(AssessmentPaperPerson record);

    int count(AssessmentPaperPersonSearchVo assessmentPaperPersonSearchVo);

    List<AssessmentPaperPersonVo> selectList(AssessmentPaperPersonSearchVo assessmentPaperPersonSearchVo);

    AssessmentPaperPersonVo selectVoById(Long id);

    int insertBatch(@Param("entities") List<AssessmentPaperPerson> entities);

    /**
     * 查询某次考核的所有人的平均分
     *
     * @param assessmentId
     * @return
     */
    BigDecimal selectAvgScoreByAssessmentId(Long assessmentId);

    /**
     * 根据考核ID与人ID查询
     *
     * @param assessmentId
     * @param personId
     * @return
     */
    AssessmentPaperPersonVo selectByAssessmentIdAndPersonId(@Param("assessmentId") Long assessmentId, @Param("personId") Long personId);

}